#!/bin/sh
set -e

printf "Creating macrodir...\n"
macrodir="$( sed    -e '/^AC_CONFIG_MACRO_DIR(\[\(.*\)\])/!d;'  \
                    -e 's//\1/;'                                \
                    configure.ac                                \
           )"
mkdir -p "${macrodir}"

printf "Running autoreconf...\n"
autoreconf -f -i -Wall

# Cleanup the useless stuff... :-(
rm -rf autom4te.cache

printf "Done. You may now run:\n    ./configure\n"
